<?php


if ($_SESSION['logged'] == true) {

	$name = $_SESSION['username'];

	$player_active = $player->get(0,"", 1, $_SESSION['uid']);

	if (count($player_active) > 0) {
		$active_char = "Active Char:<br>";

		$active_char .= "<a href=\"index.php?page=panel\"><b>";

		$active_char .= $player_active[0]['name'];

		$active_char .= "</b></a><br>";
	} else {
		$active_char = "<b><a href=\"index.php?page=panel\"><img src='./images/buttons/icon-hint.png' width='21px' height='21px'><br>No active Char selected</a></b><br>";
	}
	$info1 = array('title' => 'User', 'text'=> "You are logged in as: <b>$name</b><br><br>$active_char<br><a href=\"index.php?page=logout\"><b>Logout</b></a>");
} else {
	$info1 = array('title' => 'User', 'text'=> "You are not logged in.<br><br><a href=\"index.php?page=login\"><b>Login</b></a>");
}


if(is_allowed($USER_RIGHTS['news_list'])) {
	$administration .= "<b><a href='index.php?page=admin_news'>News</a></b><br>";
}

if(is_allowed($USER_RIGHTS['download_list'])) {
	$administration .= "<b><a href='index.php?page=admin_download'>Downloads</a></b><br>";
}

if(is_allowed($USER_RIGHTS['user_list'])) {
	$administration .= "<b><a href='index.php?page=admin_users'>Users</a></b><br>";
}

if(is_allowed($USER_RIGHTS['attribute_list'])) {
	$administration .= "<b><a href='index.php?page=admin_attribute'>Attributes</a></b><br>";
}


if(is_allowed($USER_RIGHTS['rp_category_list'])) {
	$administration .= "<b><a href='index.php?page=admin_rpcategory'>RP Categories</a></b><br>";
}


if(is_allowed($USER_RIGHTS['event_list'])) {
	$administration .= "<b><a href='index.php?page=admin_event'>Events</a></b><br>";
}

if(is_allowed($USER_RIGHTS['team_list'])) {
	$administration .= "<b><a href='index.php?page=admin_team'>Teams/Ranks</a></b><br>";
}


$info2 = array('title' => 'Administration', 'text'=> "$administration");


/*
$total_players = $player->count(0, '', 0);

$total_players = $total_players[0][0];

$class_totals = $player->count(0, 'Druid', 0);


$chart = new PieChart(500, 350);

$dataSet = new XYDataSet();


foreach ($class_totals as $class) {

	$class_text .= "<b>" . $class['class'] . ":</b>" .  $class['total'] . "<br>";

	$dataSet->addPoint(new Point($class['class'], $class['total']));
	
}


$chart->setDataSet($dataSet);

$chart->setTitle("Class Balance");
$chart->render("./images/statistics.png");

$info3 = array('title' => '<span {popup text="<img src=./images/statistics.png>" center=#overlib_center# wrap=#overlib_wrap# offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}> Statistics</span>', 'text'=> "<b>Characters:</b> $total_players<br>$class_text");
*/

$recruitment_status = $settings->get(0, '', 'recruitment');

foreach ($classes as $class) {
	$recruitment_text .= "<b>" . $class['class'] . ":</b>" .  $class['total'] . "<br>";
}

$info3 = array('title' => 'Recruitment', 'text'=> "");

if(is_allowed(3)) {
	$infoboxes = array($info1, $info2, $info3);
} else {
	$infoboxes = array($info1, $info3);
}


$smarty->assign('infoboxes', $infoboxes);

$smarty->display('left_column.tpl', $_SESSION['uid']);



?>